	
	
	var divPopupContainer = "divViewContainer"; 
	var divLightBox = "divLightBox";
	var lightViewClass = "divExpand";
	var intVarID = 0;
	var strErrorMsg = "<table border='0' width='100%' height='100%' cellpadding='0' style='border-collapse: collapse'><tr><td width='6%'><font face='Verdana' size='2'><img border='0' src='/images/error.png' width='32' height='32'></font></td><td width='26%'><p align='left'><font face='Verdana' size='2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>&nbsp;Error !</b></font></td></tr><tr><td colspan='2'><p align='left'><font face='Verdana' size='2'>Could Not Complete	Request.<br></font></td></tr></table>";
	var strCloseButton = "<img id=imgWait width=\"30\" height=\"30\" title=\"Close\" style=\"cursor: pointer;\" src=\"../vphms/images/close-icon.png\" align=right onclick=\"JavaScript: removeDiv( divPopupContainer );removeDiv( divLightBox );\"><br>";

	function appendDiv( strDivName ) {
		$( "body" ).append( "<div id=" + strDivName + "></div>");
		$( '#' + strDivName ).fadeOut("slow");		
	}	
	function removeDiv( strDivName ) {		
		$( '#' + strDivName ).fadeOut("slow");
		$( "body" ).remove( "#" + strDivName );	
	}	
		
	

$(function() {	
	appendDiv( divLightBox );
	appendDiv( divPopupContainer );
	$( '.' + lightViewClass ).click(
		function() {										
			expandDivView( 1,$(this).attr("id") );
		} );			
	} );
	
	$.fn.contextmenu = function(func) {return this.bind("contextmenu", func);
} 	  	  
	  
function getMenu(intVarID) {
	
	var menuItem  = "<a class=RightMenuLink onclick='expandDivView( " + intVarID + ",\"view\" );'>View</a> | ";		
	menuItem += "<a class=RightMenuLink onclick='expandDivView( " + intVarID + ",\"edit\" );'>Edit</a> | ";	
	menuItem += "<a class=RightMenuLink onclick='expandDivView( " + intVarID + ",\"delete\" );'>Delete</a> | ";	
	menuItem += "<a class=RightMenuLink onclick='expandDivView( " + intVarID + ",\"block\" );'>Block</a> | ";			
	return menuItem; 
}

function expandDivView( intVarID,strAction ) {	
	var intDocHeight = $(document).height();
	var intDocWidth = $(document).width();	
	$('#divLightBox').fadeIn('slow');			
	ajaxFunction( intVarID,strAction );
	var divHeight = $( '#divViewContainer' ).height();	
	var divwidth = $( '#divViewContainer' ).width();	
	var intTopPos = ( ( intDocHeight / 2 ) - ( divHeight ) / 2 ); 		
	var intLeftPos = ( ( intDocWidth / 2 ) - ( divwidth ) / 2 ); 		
}

function ajaxFunction( intVarID, strAction ) {	
	$( '#divViewContainer' ).html("");
	$( '#divViewContainer' ).css("top","45%");
	$( '#divViewContainer' ).append( "<img src=/vphms/images/loading.gif>" );	
	$('#divViewContainer').fadeIn();
	
	$.ajax({
        type: 'POST',
        url: strAction,
        success: function ( html ) {    
			$( '#divViewContainer' ).html("");
			$( '#divViewContainer' ).css("top","0%");
			$( '#divViewContainer' ).append( strCloseButton + html );
			$('#divViewContainer').hide();
			$('#divViewContainer').fadeIn();
        },
        error: function () {
            $( '#divViewContainer' ).html("");
			$( '#divViewContainer' ).append( strCloseButton + strErrorMsg );
        }
    });		
}
